package com.zcc.lesson02;

import com.zcc.lesson02.utils.JDBCUtils;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

public class Test {
    public static void main(String[] args) {
        Connection conn = null;
        Statement stmt = null;
        ResultSet rs = null;

        try {
            conn = JDBCUtils.getConnection();
            stmt = conn.createStatement();
            String sql = "insert into users(id,name,password,email,birthday) values(4,'zcc','123456','test@qq.com','2024-12-19')";
            String sql2 = "delete from users where id=4";
            String sql3 = "update users set name='zhf' where id=1";
            int i = stmt.executeUpdate(sql);
            if (i > 0) {
                System.out.println("插入成功！");
            }
        }catch (Exception e) {
            e.printStackTrace();
        }
        finally {
            JDBCUtils.release(conn, stmt, rs);
        }
    }
}
